//////////////////////////////////////////////////////////////////////////////////
//	File	:	BaseParticleEffect.h
//	Author	:	Yuri Oyoko
//	Purpose	:	Base particle effect is the parent effect for all in-game particle
//				effects (i.e. fire, smoke e.t.c.). BaseParticleEffect defines the
//				way in which the particles in the system behave.
//////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "Particle.h"
#include <d3dx9.h>
#include <vector>
#include <queue>
#include <deque>
#include "BaseObject.h"

using std::vector;

class BaseParticleSystem : public BaseObject 
{
private:
	Particle* Particles;
	vector<Particle*> FreeParticles;
	float EffectLifetime;

protected:
	int ParticlesInSystem;
	int NumberOfEffects;
	int ParticleTexture;
	float MinParticleSpeed;
	float MaxParticleSpeed;
	float MinParticleAngle;
	float MaxParticleAngle;
	float MinParticleAcceleration;
	float MaxParticleAcceleration;
	float MinParticleRotationSpeed;
	float MaxParticleRotationSpeed;
	float MinParticleLifetime;
	float MaxParticleLifetime;
	int MinParticleCount;
	int MaxParticleCount;
	
	 virtual void InitializeConstants(){};
	 BaseParticleSystem(int ParticleCount){NumberOfEffects = ParticleCount;}
	 D3DXVECTOR2 GetRandomDirection();
	 void InitializeParticle(Particle* theParticle, D3DXVECTOR2 theLocation);
	
	 
public:
	BaseParticleSystem();
	~BaseParticleSystem();
    
    void Initialize();
    void AddParticles(D3DXVECTOR2 Location);
	
	//BaseObject
	void Update(float ElapsedTime);
	void Render();
	RECT GetCollisionRect();
	bool CheckCollision();

};